import sys
from tkinter import *


def quit():
    print("退出软件")
    sys.exit()


widget = Button(None, text="退出", command=quit)
widget.pack()
widget.mainloop()
